package com.android.fragmentdemo.roomdb
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update

@Dao
interface UserDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertUser(vararg user: User)

    @Query("select * from user")
    fun queryAll(): MutableList<User>

    @Query("select * from user where id=:id")
    fun query(id: String): User

    @Update
    fun update(user: User)

    @Delete
    fun delete(user: User)
}